package com.example.PLDroidMediaStreaming;

import android.content.Context;

import java.util.Map;

import io.flutter.plugin.common.MessageCodec;
import io.flutter.plugin.platform.PlatformView;
import io.flutter.plugin.platform.PlatformViewFactory;

public class PLDroidMediaStreamingRenderViewFactory extends PlatformViewFactory {
  private final PLDroidMediaStreamingPlugin mEnginePlugin;

  public PLDroidMediaStreamingRenderViewFactory(MessageCodec<Object> createArgsCodec, PLDroidMediaStreamingPlugin enginePlugin) {
    super(createArgsCodec);
    this.mEnginePlugin = enginePlugin;
  }

  @Override
  public PlatformView create(Context context, int id, Object o) {
    Map<String, Object> params = (Map<String, Object>)o;
    PLDroidMediaStreamingRenderView rendererView = new PLDroidMediaStreamingRenderView(context, id, params);
    this.mEnginePlugin.addView(rendererView, id);
    return rendererView;
  }
}

